Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #to_rack to handle non-array response bodies. #150

Merged
merged 1 commit into from Jan 22, 2012

Conversation

tammersaleh
Copy link
Contributor

When using #to_rack with a Rails endpoint, such as:

stub_request(:any, %r{api.example.com/.*}).to_rack(Rails.application)

...you receive the following error:

NoMethodError: undefined method `join' for #<ActionDispatch::Response:0x007ffd06e6f540>

Turns out ActionDispatch::Response is in the right. A Rack response body
is only required to implement #each, not #join.

This patch fixes #to_rack to build the body using the #each method.

When using #to_rack with a Rails endpoint, such as:

  stub_request(:any, %r{api.example.com/.*}).to_rack(Rails.application)

...you receive the following error:

  NoMethodError: undefined method `join' for #<ActionDispatch::Response:0x007ffd06e6f540>

Turns out ActionDispatch::Response is in the right. A Rack response body
is only required to implement #each, not #join.

This patch fixes #to_rack to build the body using the #each method.
@bblimke
Copy link
Owner

bblimke commented Jan 22, 2012

Thank you for the patch!

bblimke added a commit that referenced this pull request Jan 22, 2012
Fix #to_rack to handle non-array response bodies.
@bblimke bblimke merged commit d0c58e9 into bblimke:master Jan 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants